package com.yoomiito.app.ui.my.teamallowance

import cn.droidlover.xdroidmvp.net.ApiException
import cn.droidlover.xdroidmvp.net.ApiSubscriber
import cn.droidlover.xdroidmvp.net.XApi
import com.yoomiito.app.base.AppConfig
import com.yoomiito.app.base.BaseActPresenter
import com.yoomiito.app.model.my.TeamAllowance
import com.yoomiito.app.net.YmApi

class TeamAllowancePresenter(appConfig: AppConfig) : BaseActPresenter<TeamAllowanceActivity>(appConfig) {

    fun getList() {
        YmApi.getYmService()
                .teamDetail()
                .compose(v.bindToLifecycle())
                .compose(XApi.getApiTransformerData())
                .compose(XApi.getScheduler())
                .subscribe(object : ApiSubscriber<TeamAllowance>(handleException()) {
                    override fun onSuccess(t: TeamAllowance?) {
                        if (hasV())
                            v.setData(t)
                    }

                    override fun onFail(error: ApiException?) {

                    }

                })
    }
}